<template>
  <ElInput :disabled="isDisabled"></ElInput>
</template>

<script setup lang="ts">
import { ref, inject } from 'vue';
import { ElInput } from 'element-plus';
import { columnWrapperKey } from '../table-column/table-column-wrapper';

const $props = defineProps({
  disabled: {
    type: Boolean,
    default: undefined,
  },
});
const isDisabled = ref(false);

if ($props.disabled === undefined) {
  const columnWrapper = inject(columnWrapperKey);
  // console.log('columnWrapper', columnWrapper);
  if (columnWrapper?.state === 'edit') {
    isDisabled.value = false;
  } else {
    isDisabled.value = true;
  }
}
</script>

<style scoped></style>
